package com.serkol.exception;

import com.serkol.component.LocalUtil;
import com.serkol.constant.ResultCode;

public class BaseException extends Exception {
    private int code;
    private String key;

    public BaseException() {
        super();
    }

    public BaseException(ResultCode resultCode) {

        super(LocalUtil.get(resultCode.getMsg()));
        //   String msg = resultCode.getMsg();
        this.code = resultCode.getCode();
        this.key=resultCode.getMsg();
    }
    public BaseException(ResultCode resultCode,String msg) {
        super(LocalUtil.get(msg));
        System.out.println("BaseException:"+msg);
        //   String msg = resultCode.getMsg();
        this.code = resultCode.getCode();
        this.key=resultCode.getMsg();
    }

    public BaseException(ResultCode resultCode, Throwable cause) {

        super(LocalUtil.get(resultCode.getMsg()), cause);
        this.code = resultCode.getCode();
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    @Override
    public Throwable fillInStackTrace() {
        return this;
    }
}
